package Test1.Thermometry;

import Test1.HCNetSDK;
import com.sun.jna.NativeLong;
import com.sun.jna.ptr.IntByReference;

import javax.swing.*;

/**
 * Created by panting6 on 2021/1/25.
 */
public class ThreadGetOnceTempData {

    static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;

    public void threadGetOnceTempData(int lUserID, NativeLong RuleID)
    {
        HCNetSDK.NET_DVR_THERMOMETRYRULE_TEMPERATURE_INFO m_TherTemInfo = new HCNetSDK.NET_DVR_THERMOMETRYRULE_TEMPERATURE_INFO();
        IntByReference lpBytesReturned = new IntByReference(0);
        if(!hCNetSDK.NET_DVR_GetDVRConfig(lUserID,HCNetSDK.NET_DVR_GET_THERMOMETRYRULE_TEMPERATURE_INFO,RuleID,m_TherTemInfo.getPointer(),16*1024,lpBytesReturned))
        {
            System.out.println( "手动获取测温规则温度信息失败，错误号：" + hCNetSDK.NET_DVR_GetLastError());
        }
        else
        {
            m_TherTemInfo.read();
            System.out.println( "手动获取测温规则温度信息成功!");

            System.out.println("最高温：" + m_TherTemInfo.fMaxTemperature + " 最低温：" + m_TherTemInfo.fMinTemperature + " 平均温："+m_TherTemInfo.fAverageTemperature
                    + " 最高温点坐标：（" + m_TherTemInfo.struHighestPoint.fX + "," + m_TherTemInfo.struHighestPoint.fY + ")"
                    + " 最低温点坐标：（" + m_TherTemInfo.struLowestPoint.fX + "," + m_TherTemInfo.struLowestPoint.fY + ")");
        }
    }

}
